package com.skycode5.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class NewsDetailServelt  extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String newsID = req.getParameter("newsID");
        int id = Integer.parseInt(newsID);
        NewsBean newsBean = (new NewsDao()).getNewsByID(id);
        req.setAttribute ("title",  newsBean.getNewsTitle());
        req.setAttribute(" content", newsBean.getNewsContent());
        req.getRequestDispatcher("newsFrontDetail.jsp").forward(req, resp);
    }
}
